/*
 * File:    Defines_GroundLink.h
 * Project:	HobbyPilotFirmware (HPF)
 * Author:  Wouter van Verre
 *
 * Created on February 20, 2011, 5:12 PM
 */

#ifndef __DEFINES_GROUNDLINK_H
#define __DEFINES_GROUNDLINK_H

/** Defines **/
#define READONLY	0
#define READWRITE 	1

#define X25_INIT_CRC 0xFFFF

#define GL_COMP_IMU_ID	1
#define GL_COMP_AP_ID	2

#define GL_MSG_HEARTBEAT_ID		1
#define GL_MSG_SENDPARAM_ID		2

#define GL_PARAM_ROTATIONMATRIX_ID	1
#define GL_PARAM_CPULOADINFO_ID	2

/** Structures **/
typedef struct
{
	char name[20];
	void (*send_parameter)(void);
	void (*set_parameter)(void);
	uint8 readonly;	
} GroundLinkParameter;

/** Variables **/
extern uint8 GLCompIMUSendSeq;

/** Functons **/
/** CRC **/
extern void crc_init(uint16* crcAccum);
extern void crc_accumulate(uint8 data, uint16 *crcAccum);
extern void crc_calculate(uint8* pBuffer, int length, uint16* pChecksum);


/** Parameter Functions **/
extern void GL_Send_RotationMatrix(void);
extern void GL_Send_CPULoadInfo(void);

#endif
